using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpgradeMuzzleShockwave:Upgrade {

	float sizeAccumulated;

	protected override void ShootingEventHandler(object _sender,ShootEventArgs e) {
		base.ShootingEventHandler(_sender,e);
		sizeAccumulated=0;
	}
	protected override void ProjectileFiredEventHandler(object _sender,ProjectileEventArgs e) {
		base.ProjectileFiredEventHandler(_sender,e);
		sizeAccumulated+=e.stat.size;
		Debug.Log("AAA");
	}

	void ShotEventHandler(object _sender,ShootEventArgs e) {
		Projectile projectile = weaponWeapon.ShootSingleProjectile(
			weaponWeapon.muzzleWorldPosition,
			weaponWeapon.state.aimAngle,
			ProjectileData.nameToData["HalfShockwave"],
			new Dictionary<int,int>()
		);
		projectile.stat.damage.baseValue=15+sizeAccumulated*3;
		projectile.stat.size.AddMultiply(2,2);
		sizeAccumulated=0;

	}

	protected override void SubscribeEvents() {
		base.SubscribeEvents();
		WeaponEventHelper.shot.SubscribeSingle(weaponWeapon,ShotEventHandler);
	}
	public override void UnsubscribeEvents() {
		base.UnsubscribeEvents();
		WeaponEventHelper.shot.UnsubscribeSingle(weaponWeapon,ShotEventHandler);
	}
}
